package com.example.demo_01.util;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ResultBean {
    private int code;
    private String msg;
    private Object data;


    private ResultBean() {

    }
    public static ResultBean getInstance(){
        return new ResultBean();
    }
    public ResultBean success(){
        this.code = 200;
        this.msg = "success";
        return this;
    }
    public ResultBean success(String msg){
        this.code = 200;
        this.msg = msg;
        return this;
    }
    public ResultBean fail(){
        this.code = 500;
        this.msg = "fail";
        return this;
    }
    public ResultBean fail(String msg){
        this.code = 500;
        this.msg = msg;
        return this;
    }
    public ResultBean fail(int code,String msg){
        this.code = code;
        this.msg = msg;
        return this;
    }

    public ResultBean setData(Object data){
        this.data = data;
        return this;
    }
}
